#!/bin/rc

rfork e

x=($*)
if(~ $#x 0){
	x=`{ps |awk '$NF=="8.fossil" {print $2}'}
	ps | awk '$7=="8.fossil"'
}
if(~ $#x 0){
	x=`{ps | awk '$NF=="fossil" {print $2}'}
	ps -a | awk '$7 == "fossil"'
}

y=$x^', '
y=$"y
echo 'include("/sys/src/cmd/fossil/fossil-acid");
print("--XXX\n");
deadlocklist({' ^ $y ^ '});
print("--YYY\n");' |
	acid $x(1) |
	sed -n '/--XXX/,/--YYY/p' |
	sed 's/acid: //g' |
	grep -v '^--'

